char* compressString(char* S) {
    int len = strlen(S);
    if (len <= 2)
        return S;
    char* ret = (char*)malloc(sizeof(char) * 2 * len);
    int i = 0;
    int j = 0; //维护数组的遍历
    int k = 0; //维护开辟数组的遍历
    while (i < len) {
        //先存字母
        ret[k++] = S[i];
        while (j < len && S[i] == S[j]) {
            j++;
        }
        int count = j - i;        //字符个数
        int c = log10(count) + 1; //个数位数
        k = k + c - 1;
        while (count) {
            ret[k--] = count % 10 + '0';
            count /= 10;
        }
        k = k + c + 1;
        i = j;
    }
    ret[k] = '\0';
    int len2 = strlen(ret);
    if (len < len2)
        return S;
    else
        return ret;
}